﻿using UnityEngine;
using System.Collections;

public class MainMenuScript : MonoBehaviour {

	public GUITexture newGame;
	public GUITexture exit;

	void Update()
	{
		if (Input.GetKey(KeyCode.Escape))
		{
			Application.Quit();
		}
		/*if (Input.GetButtonDown ("Fire1")) {
			Vector3 mousePos = Input.mousePosition;
			if (newGame.HitTest(new Vector3(mousePos.x, mousePos.y, 0 ))){
				Application.LoadLevel("Game");
			}
			
			if (exit.HitTest(new Vector3(mousePos.x, mousePos.y, 0 ))){
				Application.Quit();
			}
		}*/
		foreach (Touch touch in Input.touches) 
		{
			if (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled)
			{
				if (newGame.HitTest(new Vector3(touch.position.x, touch.position.y, 0 ))){
					Application.LoadLevel("Game");
				}

				if (exit.HitTest(new Vector3(touch.position.x, touch.position.y, 0 ))){
					Application.Quit();
				}
			}
		}
	}
}
